<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<input type="hidden" name="keyId" id="keyId" value="<s:property value="user.id" />">
<input type="hidden" name="todoTask" id="todoTask" value="<s:property value="todoTask" />">
<input type="hidden" name="finishTask" id="finishTask" value="<s:property value="finishTask" />">

<section id="widget-grid" class="">
	<div class="row">
		<article class="col-sm-12 col-md-12 col-lg-12">
            <div class="jarviswidget jarviswidget-color-blue" id="wid-id-0"
                 data-widget-editbutton="false"
                 data-widget-togglebutton="false"
                 data-widget-colorbutton="false"
                 data-widget-deletebutton="false"
                 data-widget-fullscreenbutton="false"
                 data-widget-custombutton="false"
                 data-widget-collapsed="false"
                 data-widget-sortable="false" role="widget">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="well well-sm">
                            <div class="row">
                                <div class="col-sm-12 col-md-12 col-lg-6">
                                    <div class="well well-light well-sm no-margin no-padding">
                                        <div class="row">
                                            <div class="col-sm-12">
                                                <div class="row">
                                                    <div  class="col-sm-3 profile-pic">
                                                        <img id="users_image" style="top:0;margin-bottom:0" src="file.action?keyId=<s:property value="user.id" />" />
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <h1><s:property value="user.name" />
                                                            <br>
                                                            <small><s:property value="admin.usermobile" /></small></h1>

                                                        <ul class="list-unstyled">
                                                            <li>
                                                                <p class="text-muted">
                                                                    <i class="fa fa-envelope"></i> 手机号：<s:property value="user.mobile" />
                                                                </p>
                                                                <p class="text-muted">
                                                                    <input  name="uploadify" id="ajax_user_file" placeholder="" type="file" >
                                                                </p>
                                                            </li>
                                                        </ul>
                                                        <br>

                                                    </div>
                                                </div>

                                            </div>

                                        </div>


                                        <!-- end row -->


                                    </div>
                                </div>
                                <div class="col-sm-12 col-md-12 col-lg-6">
                                    <div class="well well-light well-sm ">
                                        <div class="row">
                                            <div class="col-sm-12">
                                                <div class="row">

                                                    <div class="col-sm-12">
                                                        <h2>所属企业：<s:property value="user.company.name"/>
                                                            <br>
                                                        </h2>
                                                        <ul class="list-unstyled">
                                                            <li>
                                                                <p class="text-muted">
                                                                    <i class="fa fa-envelope"></i> 简称：<s:property value="user.company.subname"/>
                                                                </p>
                                                            </li>
                                                        </ul>
                                                        <br>
                                                    </div>

                                                </div>

                                            </div>

                                        </div>
                                    </div>

                                </div>
                            </div>

                        </div>


                    </div>
                    <div class="row">
                        <header role="heading">
                            <span class="widget-icon"> <i class="fa fa-exclamation-circle"></i> </span>
                            <s:if test="taskArrayList.size() > 0">
                                <div class="widget-toolbar" role="menu">
                                    <a href="javascript:void(0);" id="approve_btn" class="btn btn-primary btn-sm">一键通过</a>
                                </div>
                            </s:if>

                        </header>
                        <div role="content">
                            <div class="jarviswidget-editbox">

                            </div>
                            <div class="widget-body">
                                <ul class="notification-body">
                                    <s:if test="taskArrayList.size() > 0">
                                        <s:iterator value="taskArrayList" id="list">
                                            <li>
                                                <div class="checkbox">
                                                    <label>
                                                        <input value="<s:property value="#list.docId"/>" type="checkbox"  name="businessKeyList" class="checkbox style-0"/>
                                    <span class="col-xs-12">
                                        <img style="border-radius: 50%;" height="30" width="30" alt="" src="<s:property value="getFile(#list.creator.id)" />">
                                            <s:property value="#list.creator.name"/>于<s:property value="#list.createDate"/>发起
                                            <span class="label label-primary"><s:property value="#list.pname"/></span>
                                            ，当前正处于
                                            <span class="label label-success">
                                                <s:property value="#list.taskname"/>
                                            </span>，当前状态为
                                            <span class="label label-warning">
                                                <s:property value="#list.state"/>
                                            </span>
                                            <span class="label">
                                                <a href="javascript:void(0);" key="ajax_approve_btn" id="<s:property value="#list.url"/>"  class="btn btn-default pull-right "><i class="fa fa-hand-o-right"></i> 处理</a>
                                            </span>
                                    </span>

                                                    </label>
                                                </div>
                                            </li>
                                        </s:iterator>
                                    </s:if>
                                    <s:else>
                                        <h4> </h4>
                                    </s:else>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

            </div>



		</article>

	</div>
</section>
<script type="text/javascript">
//	pageSetUp();
//	var labelTop = {
//		normal : {
//			label : {
//				show : true,
//				position : 'center',
//				formatter : '{c}%',
//				textStyle: {
//					baseline : 'center',
//					fontWeight: 'bolder',
//					fontSize: 18,
//					y:113
//				}
//			},
//			labelLine : {
//				show : false
//			}
//		}
//	};
//	var labelFromatter = {
//		normal : {
//			label : {
//				textStyle: {
//					baseline : 'top'
//				}
//			}
//		}
//	};
//	var labelBottom = {
//		normal : {
//			color: '#ccc',
//			label : {
//				show : false,
//				position : 'center'
//			},
//			labelLine : {
//				show : false
//			}
//		},
//		emphasis: {
//			color: 'rgba(0,0,0,0)'
//		}
//	};
//	var radius = [40, 55];
//	option = {
//		title: {
//			text: '项目统计',
//			x: 'center'
//		},
//		series: [
//			{
//				type: 'pie',
//				center: ['48%', '30%'],
//				radius: radius,
//				x: '0%', // for funnel
//				itemStyle: labelFromatter,
//				data: [
//					{name: '未完成', value:$("#todoTask").val(), itemStyle: labelBottom},
//					{name: '完成', value:$("#finishTask").val(), itemStyle: labelTop}
//				]
//			},
//		]
//	};
//	var chart = echarts.init(document.getElementById("pie_task"));
//	chart.setOption(option);

	//显示个人的流转中、已归档数据
	$(function(){
		//loadURL("ajax-users!listTodo.action",$("#ajax_todoTask_list_row"));
	});

    //一键审批
    $("#approve_btn").click(function(){
        var businessKeyList = "";
        $("input[name='businessKeyList']").each(function(i,v){

            if($(this).prop("checked")){
                businessKeyList= businessKeyList +","+ $(this).val();
            }
        });
        ajax_action("ajax-users!batchApprove.action",{businessKeyList:businessKeyList},null,function(pdata){
            _show(pdata);
        });
        loadURL("ajax-users!profile.action",$("#content"));
    });

    $("a[key='ajax_approve_btn']").click(function(){
        var actionUrl=$(this).attr("id");
        loadURL(actionUrl,$("#content"));
    });

$(function(){
    $("#ajax_user_file").uploadify({
        height        	: 30,
        multi : false,
        fileSizeLimit : '5MB',
        fileDataName : 'uploadify',
        progressData : 'percentage',
        'fileTypeDesc' : '格式:jpg',     //描述
        fileTypeExts : '*.jpg',
        buttonText : '选择图片上传',
        swf           : '../resource/com/js/plugin/uploadify/uploadify.swf',
        uploader      : 'ajax-users!uploadImg.action',
        width         : 140,
        onUploadStart:function(file){
            $("#import_message_alert").empty();
            $('<div class="alert alert-info fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-info"></i><strong>正在努力为您处理！</strong> 导入过程分校验和导入两部分，请耐心等待...</div>').appendTo($("#import_message_alert"));

        },
        onUploadSuccess : function(file, data, response) {
            $("#import_message_alert").empty();
            var json = jQuery.parseJSON(data);
            if(json && json.status == "200"){
                $('<div class="alert alert-success fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-check"></i><strong>上传完毕</strong> 相片上传成功！</div>').appendTo($("#import_excel_message_alert"));
                $(json.rows).each(function(index,map){
                    $('<div class="alert alert-info fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-info"></i><strong>提醒！</strong> '+map.id+'</div>').appendTo($("#import_excel_message_alert"));
                });
                $("#users_image").attr("src",json.fileUrl);
            }else{
                $('<div class="alert alert-info fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-info"></i><strong>上传失败！</strong> </div>').appendTo($("#import_message_alert"));
            }
        }
    });

});
</script>